﻿Imports System.Windows.Forms

Public Class zuFragenForm

    Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
        FragenForm.akt_la = ComboBox1.SelectedIndex + 1
        FragenForm.akt_nr = ComboBox2.SelectedIndex + 1
        FragenForm.dialog_close()
        Me.Close()
    End Sub

    Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.Close()
    End Sub

    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        ComboBox2.Enabled = True

        Dim anzahl = StartForm.frag_an(ComboBox1.SelectedIndex + 1)
        ComboBox2.Items.Clear()
        For index = 1 To anzahl
            If StartForm.fragen(ComboBox1.SelectedIndex + 1, index, 0).Length < 50 Then
                ComboBox2.Items.Add(index.ToString("D2") & "-" & StartForm.fragen(ComboBox1.SelectedIndex + 1, index, 0).Substring(0, StartForm.fragen(ComboBox1.SelectedIndex + 1, index, 0).Length))

            Else
                ComboBox2.Items.Add(index.ToString("D2") & "-" & StartForm.fragen(ComboBox1.SelectedIndex + 1, index, 0).Substring(0, 50) & "...")

            End If
        Next

    End Sub

    Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
        OK_Button.Enabled = True
    End Sub
End Class
